import 'package:agro_sklad_new/core/errors/failure.dart';
import 'package:agro_sklad_new/feature/domain/entities/stock_entity.dart';
import 'package:agro_sklad_new/feature/domain/repositories/stock_repository.dart';
import 'package:dartz/dartz.dart';

import '../../../core/errors/exceptions.dart';
import '../../../core/platform/networl_info.dart';
import '../datasources/stock/stock_remoute_data_sourse.dart';

class StockRepositoryImpl implements StockRepository{
  final StockRemoteDataSource remoteDataSource;
  final NetworkInfo networkInfo;


  StockRepositoryImpl({required this.remoteDataSource, required this.networkInfo});

  @override
  Future<Either<Failure, List<StockEntity>>> getAllStock() async{
      try {
        final List<StockEntity>remoteStock = await remoteDataSource.getAllStock();
        return Right(remoteStock );
      } on ServerException {
        return Left(ServerFailure());
      }
  }
}